import mongoose from 'mongoose';

export interface IWord extends mongoose.Document {
  word: string;
  pronunciation: string;
  meaning: string;
  example: string;
  category: mongoose.Types.ObjectId;
  difficulty: 'easy' | 'medium' | 'hard';
  createdAt: Date;
  updatedAt: Date;
}

const wordSchema = new mongoose.Schema({
  word: {
    type: String,
    required: true,
    unique: true,
    trim: true
  },
  pronunciation: {
    type: String,
    required: true,
    trim: true
  },
  meaning: {
    type: String,
    required: true
  },
  example: {
    type: String,
    required: true
  },
  category: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Category',
    required: true
  },
  difficulty: {
    type: String,
    enum: ['easy', 'medium', 'hard'],
    default: 'medium'
  }
}, {
  timestamps: true
});

export const Word = mongoose.model<IWord>('Word', wordSchema); 